<!--
 * @Author: your name
 * @Date: 2020-08-22 01:51:42
 * @LastEditTime: 2020-08-27 21:55:33
 * @LastEditors: 马卓
 * @Description: In User Settings Edit
 * @FilePath: \exam-list\src\components\checkpaper\PaperDetail.vue
-->
<template>
  <div>
    <h2>查看试题</h2>
    <card>
      <div>题目信息</div>
      <div>题干</div>
      <Input v-model="obj.title" placeholder="题目" style="width: 300px" />
      <div>题目主题</div>
      <div>
        <editor-bar v-model="obj.questions_stem" :isClear="isClear" @change="change"></editor-bar>
      </div>
      <!--下拉框-->
      <Form label-position="top">
        <FormItem label="请选择考试类型:">
          <Select v-model="obj.exam_id">
            <Option
              v-for="(item) in AllExamTypes"
              :key="item.exam_id"
              :value="item.exam_name"
            >{{item.exam_name}}</Option>
          </Select>
        </FormItem>
        <FormItem label="请选择课程类型:">
          <Select v-model="obj.subject_id">
            <Option
              v-for="(item) in examType"
              :key="item.subject_id"
              :value="item.subject_id"
            >{{item.subject_text}}</Option>
          </Select>
        </FormItem>
        <FormItem label="请选择题目类型:">
          <Select v-model="obj.questions_type_id">
            <Option
              v-for="(item) in QuestionsTypes"
              :key="item.questions_type_id"
              :value="item.questions_type_id"
            >{{item.questions_type_text}}</Option>
          </Select>
        </FormItem>
      </Form>
      <div>答案信息</div>
      <div>
        <editor-bar v-model="obj.questions_answer" :isClear="isClear" @change="change"></editor-bar>
      </div>
    </card>
    <Button type="primary" @click="submitEdit">提交</Button>
  </div>
</template>

<script>
// import EditorBar from '../wangEnduit/wangEnduit'
import { mapActions, mapState } from 'vuex'
export default {
  components: {
    // EditorBar
  },
  data() {
    return {
      isClear: false,
      obj: {
        title: '',
        questions_stem: '',
        questions_answer: '',
        subject_id: '',
        questions_type_id: '',
        exam_id: '',
        questions_id: ''
      }
    }
  },
  computed: {
    ...mapState('ViewQuestions', [
      'examType',
      'QuestionsTypes',
      'AllExamTypes'
    ])
  },
  created() {
    this.obj = this.$route.query
  },
  methods: {
    ...mapActions('ViewQuestions', ['EditExams']),
    change(val) {
      console.log(val)
    },
    // 点击提交 调用方法
    submitEdit() {
      this.EditExams(this.obj)
    }
  }
}
</script>

<style lang="" scoped>
</style>
